package com.pinyougou.manager.controller;

import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

@RestController
@RequestMapping("login")
public class LoginController {
    @GetMapping("name")
    public Map<String,Object> loginName() {
        String loginName = SecurityContextHolder.getContext().getAuthentication().getName();
        Map<String,Object> map=new HashMap<String,Object>();
        map.put("loginName",loginName);
        return map;
    }
}
